<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output encoding="utf-8" method="html"/>

  <xsl:template match="/">
    <html>
      <header>
        <title>View Member List using XSLT</title>
      </header>
      <body>
        <!--
            This is an XSLT template file. Fill in this area with the
            XSL elements which will transform your XML to XHTML.
        -->
        <h2>Member List</h2>
        <table style="border: solid 1px #CDCDCD;">
          <tr bgcolor="#9acd32">
            <th width="50px">ID</th>
            <th width="200px">Fullname</th>
            <th>Mobile</th>
            <td>Born in</td>
          </tr>
          <!--<xsl:for-each select="/members/member[fullname='Huan']">-->
          <xsl:for-each select="/members/member">
            <!--<xsl:sort case-order="upper-first" order="ascending" select="fullname"/>-->
            <xsl:sort case-order="upper-first" select="fullname"/>
            <xsl:if test="born &gt;= 1984">
              <tr>
                <td>
                  <xsl:value-of select="@id"/>
                </td>
                <td>
                  <xsl:value-of select="fullname"/>
                </td>
                <td>
                  <xsl:value-of select="mobile"/>
                </td>
                <td>
                  <xsl:value-of select="born"/>
                </td>
              </tr>
            </xsl:if>
          </xsl:for-each>
        </table>

        <h2>Test choose, when, otherwise...</h2>
        <table style="border: solid 1px #CDCDCD;">
          <tr bgcolor="#9acd32">
            <th width="50px">ID</th>
            <th width="200px">Fullname</th>
            <th>Mobile</th>
            <td>Born in</td>
          </tr>
          <!--<xsl:for-each select="/members/member[fullname='Huan']">-->
          <xsl:for-each select="/members/member">
            <!--<xsl:sort case-order="upper-first" order="ascending" select="fullname"/>-->
            <xsl:sort case-order="upper-first" select="fullname"/>
            <xsl:choose>
              <xsl:when test="born &gt;= 1984">
                <tr bgcolor="#CDCDCD">
                  <td>
                    <xsl:value-of select="@id"/>
                  </td>
                  <td>
                    <xsl:value-of select="fullname"/>
                  </td>
                  <td>
                    <xsl:value-of select="mobile"/>
                  </td>
                  <td>
                    <xsl:value-of select="born"/>
                  </td>
                </tr>
              </xsl:when>
              <xsl:otherwise>
                <tr>
                  <td>
                    <xsl:value-of select="@id"/>
                  </td>
                  <td>
                    <xsl:value-of select="fullname"/>
                  </td>
                  <td>
                    <xsl:value-of select="mobile"/>
                  </td>
                  <td>
                    <xsl:value-of select="born"/>
                  </td>
                </tr>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:for-each>
        </table>
      </body>
    </html>
  </xsl:template>

</xsl:stylesheet>
